<%@page import="com.rw.table.Index"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8" contentType="text/html; charset=GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>商品目录-B2C-racewind商城</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	

	<style  type="text/css">
			@import "./css/back/header_back.css";
			@import "./css/back/category_list.css";
	</style>
	
	<script language="javascript" type="text/javascript" src="javascript/checkTools.js">
	</script> 
	<script language="javascript" type="text/javascript" src="javascript/commonCheck.js">
	</script>
	<script language="javascript" type="text/javascript" src="javascript/Admin/category_list.js">
	</script>
 	<script language="javascript" type="text/javascript">
 		function confirmDelete(txt){
 			var r = confirm(txt);
 			if(r == true){
 				return true;
 			}else{
 				return false;
 			}
 		}
 	</script>
 	 	<script language="javascript" type="text/javascript">
 		function checkLength(){
 			var r = document.getElementById(indexMsgId);checkLength()
 			if(r.length>100){
 				alert("Fuck")
 				return false;
 			}
 		}
 	</script>

  </head>
  <body>
  
     <jsp:include flush="true" page="header_back.jsp"></jsp:include>
		<div class="banner"></div>
		<div class="main">
		<h2>商品目录管理</h2>
		<div class="double1">
		<h3>目录列表</h3> 	
			
			<%
				String deleteErrorMessage = (String)request.getAttribute("deleteErrorMessage");
				if(deleteErrorMessage != null){
			%>
				<a><%=deleteErrorMessage%></a>
			<%
				}
			%>
		<%
      	@SuppressWarnings("unchecked")
      	List<Index> indexs1 = (List<Index>)request.getAttribute("indexs1"); 
		@SuppressWarnings("unchecked")
      	List<Index> indexs2 = (List<Index>)request.getAttribute("indexs2"); 
		@SuppressWarnings("unchecked")
      	List<Index> indexs3 = (List<Index>)request.getAttribute("indexs3"); 
		@SuppressWarnings("unchecked")
		List<Index> indexs4 = (List<Index>)request.getAttribute("indexs4");
		
		if(indexs1 == null || indexs2 == null || indexs3 == null || indexs4 == null){
		%>	
		<table border="0" align="center">
     		<tr>
     			<td>
     			<a>    </a> 
     			</td>
     		</tr>
     		<tr>
     			<td>
     			<a>没有可显示的数据</a> 
     			</td>
     		</tr>
     	</table>
		<%
		}else{
		%>
			<form id="listForm" action="" method="post" enctype="multipart/form-data" name="listForm">
			<div id="doublecontent1">		
			
				<table  class="category-list">
			    	<tr>
				        <td class="" colspan="3">
					        <img src="images/src/bg/plus.gif">
					        <a href="javascript:show('t0',8)">图书音像</a>
					    </td>
			        
	           		</tr>
			        <tr id="t0" style="display:none">
			          <td colspan="3">
			          	<table class="inputTable">
			             
			              <%if(indexs1 != null){%>
			              	<%Iterator<Index> iterator = indexs1.iterator(); %>
			              	<%int i = 0; %>
			              	<%while(iterator.hasNext()){ %>
			              		<%Index index = iterator.next(); %>
			              		<%if(i != 0){ %>
			              <tr>
			                	<td ><img src="images/src/bg/minus1.JPG"></td>
			                	<td >
			                	<a href=<%="getItemAction?indexId=" +index.getIndexId() %>  ><%=index.getIndexName() %></a>
			                	</td>
			                	<td>
			                	<a href=<%="getIndexAction?indexId=" + index.getIndexId() %>>修改</a>
			                	<%String temp = "确定删除目录：" + index.getIndexName() + "?"; %>
			                	<a href=<%="deleteIndexAction?indexId=" + index.getIndexId() %> onclick="return confirmDelete('<%=temp%>')">删除</a>
			                	</td>
			              </tr>
			              		<%} %>
			              		<%i ++; %>
			              	<%} %>
			              <%} %>
	          			</table>
	          		</td>
			        </tr>
			        
			        <tr>	
			          <td class="" colspan="3">
				          <img src="images/src/bg/plus.gif">
				          <a href="javascript:show('t1',8)">时尚生活</a>
			          </td>
			        </tr>
			        
			       <tr id="t1" style="display:none">
			          <td colspan="3">
			          	<table class="inputTable">
			              <%if(indexs2 != null){%>
			              	<%Iterator<Index> iterator = indexs2.iterator(); %>
			              	<%int i = 0; %>
			              	<%while(iterator.hasNext()){ %>
			              		<%Index index = iterator.next(); %>
			              		<%if(i != 0){ %>
			              <tr>
			                <td ><img src="images/src/bg/minus1.JPG"></td>
			                <td>
			                	<a href=<%="getItemAction?indexId=" +index.getIndexId() %> ><%=index.getIndexName() %></a>
			                	</td>
			                	<td>
			                	<a href=<%="getIndexAction?indexId=" + index.getIndexId() %>>修改</a>
			                	<%String temp = "确定删除目录：" + index.getIndexName() + "?"; %>
			                	<a href=<%="deleteIndexAction?indexId=" + index.getIndexId() %> onclick="return confirmDelete('<%=temp%>')">删除</a>
			                </td>
			              </tr>
			             		<%} %>
			              		<%i ++; %>
			              	<%} %>
			              <%} %>
			          </table>
			         </td>
			        </tr>
			        
			        
			        <tr>					
			         <td colspan="3">
			         	<img src="images/src/bg/plus.gif">
			          	<a href="javascript:show('t2',8)"></a><a href="javascript:show('t2',8)" class="menuLink">数码产品</a>
			         </td>
			        </tr>
			        
			        
			        <tr id="t2" style="display:none">
			          <td colspan="3">
			          	<table class="inputTable">
			              <%if(indexs3 != null){%>
			              	<%Iterator<Index> iterator = indexs3.iterator(); %>
			              	<%int i = 0; %>
			              	<%while(iterator.hasNext()){ %>
			              		<%Index index = iterator.next(); %>
			              		<%if(i != 0){ %>
			              <tr>    
			                <td><img src="images/src/bg/minus1.JPG"></td>
			                <td >
			                	<a href=<%="getItemAction?indexId=" +index.getIndexId() %> class="menuLink" ><%=index.getIndexName() %></a>
			                </td>
			                <td>
			                	<a href=<%="getIndexAction?indexId=" + index.getIndexId() %>>修改</a>
			                	<%String temp = "确定删除目录：" + index.getIndexName() + "?"; %>
			                	<a href=<%="deleteIndexAction?indexId=" + index.getIndexId() %> onclick="return confirmDelete('<%=temp%>')">删除</a>
			                </td>
			              </tr>
			             	 	<%} %>
			              		<%i ++; %>
			              	<%} %>
			              <%} %>
			          </table></td></tr>
			        
			        <tr>
			          <td class="" colspan="3">
			          	<img src="images/src/bg/plus.gif">
			            <a href="javascript:show('t3',8)">鲜花速递</a> 
			          </td>
			        </tr>
			        
			        
			        <tr id="t3" style="display:none">
			          <td colspan="3">
				          <table class="inputTable">
				          
			              <%if(indexs4 != null){%>
			              	<%Iterator<Index> iterator = indexs4.iterator(); %>
			              	<%int i = 0; %>
			              	<%while(iterator.hasNext()){ %>
			              		<%Index index = iterator.next(); %>
			              		<%if(i != 0){ %>
			              <tr>
			                <td ><img src="images/src/bg/minus1.JPG"></td>
			                <td >
			                	<a href=<%="getItemAction?indexId=" +index.getIndexId() %>><%=index.getIndexName() %></a>
			                </td>
			                <td>
			                	<a href=<%="getIndexAction?indexId=" + index.getIndexId() %>>修改</a>
			                	<%String temp = "确定删除目录：" + index.getIndexName() + "?"; %>
			                	<a href=<%="deleteIndexAction?indexId=" + index.getIndexId() %> onclick="return confirmDelete('<%=temp%>')">删除</a>
			                </td>
			              </tr>
			              		<%} %>
			              		<%i ++; %>
			              	<%} %>
			              <%} %>
				          </table>
				     </td>
			        </tr>
					
         		</table>
			</div>	
		</form>
		
			</div>
		</div>
		
			
			<div class="double2">
			<h3>添加目录</h3>
			<form id="addForm" action="addIndexAction" method="post" enctype="multipart/form-data" name="addForm" onsubmit="return checkIndexInput()">
			<div class="doublecontent2">
				<table class="itemsearch" cellpadding="5">
				   <tr>
					<th class="itemsearchth" >目 录 名：</th>
            		<td class="itemsearchtd1">
					 <input type="Text" class="inputtext" Maxlength="10" name=indexName onFocus="nextfield='password'" 
					 value=
					 <%
					 	String indexName = (String)request.getAttribute("indexName");
					 	if(indexName != null){
					 %> 
					 <%=indexName %>
					 <%
					 	}else{
					 %>
					 	""
					 <%
					 	}
					 %>
					 maxlength="25"> 
					</td>
					<td class="itemsearchtd2">
						<span class="red">*&nbsp;
							<%
								String errorMessage = (String)request.getAttribute("errorMessage");
								if(errorMessage != null){
							%>
								<%=errorMessage %>
							<% 
								}else{
								
							%>
								必输项
							<%
								}
							%>

						</span></td>
          		 </tr>
				 <tr>
				 <th class="itemsearchth">父 目 录：</th>
            		<td class="itemsearchtd1">
						<select name="indexParent">
							<%
								Long indexParent = (Long)request.getAttribute("indexParent");
								if(indexParent != null){	 
							%>
								<option 
								<%if(indexParent == 1){ %>
									selected="selected"	
								<%} %>
								value="1">图书音像</option>
								<option 
								<%if(indexParent == 2){ %>
									selected="selected"	
								<%} %>
								value="2">时尚生活</option>
								<option 
								<%if(indexParent == 3){ %>
									selected="selected"	
								<%} %>
								value="3">数码产品</option>
								<option 
								<%if(indexParent == 4){ %>
									selected="selected"	
								<%} %>
								value="4">鲜花速递</option>
							<%
								}else{
							%>
							<option value="1">图书音像</option>
							<option value="2">时尚生活</option>
							<option value="3">数码产品</option>
							<option value="4">鲜花速递</option>
							<%
								} 
							%>
						</select>
					</td>
					<td class="itemsearchtd2">&nbsp;</td>
          		 </tr>
				 <tr>
				 <th class="itemsearchth"><span class="inputHeader">目录描述：</span></th>
				<td colspan="5">
					<input type="text" name="indexMsg" id="indexMsgId" Maxlength="100" style="Height:80px" value="<%String indexMsg = (String)request.getAttribute("indexMsg");%><%if(indexMsg != null){%><%=indexMsg %><%}%>"/>
				</td>	
					<td class="itemsearchtd2">&nbsp;</td>
					
          		 </tr>
        	</table>
        	
			<div class="button1">
				<input type="submit" value="提交">
				<input type="button" value="重填" onclick="formReset('addForm')">
			</div>
			
			</div>
		</form>
		</div>
		<div class="double2">
		<h3>商品搜索</h3>
		<form  id ="searchForm" method="post" name="searchForm" action="adminSearchItemAction" onsubmit="return checkSearchInput()">
			<div class="doublecontent2">
	     	<table class="searchTable" border="0">
	     		<tr>
	     			<td>
					  <b>请选择商品类别:</b>
					</td>
					<td>
			        <select name="itemIndexId">
				          <option value="-1">所有类别</option>
				          <option value="book" disabled="disabled" >---图书音像---</option>
				          <%
				          	for(int i=1;i<indexs1.size();i++){
				          	%>	
				          	<option value="<%=indexs1.get(i).getIndexId() %>"> <%=" "+indexs1.get(i).getIndexName() %></option>
				          	<%
				          	}
				          %>
				          <option value="fashion" disabled="disabled">---时尚生活---</option>
				           <%
				          	for(int i=1;i<indexs2.size();i++){
				          	%>	
				          	<option value="<%=indexs2.get(i).getIndexId() %>"> <%=" "+indexs2.get(i).getIndexName() %></option>
				          	<%
				          	}
				          %>
				          <option value="ornament" disabled="disabled">---数码产品---</option>
				           <%
				          	for(int i=1;i<indexs3.size();i++){
				          	%>	
				          	<option value="<%=indexs3.get(i).getIndexId() %>"> <%=" "+indexs3.get(i).getIndexName() %></option>
				          	<%
				          	}
				          %>
				          <option value="dight" disabled="disabled">---鲜花速递---</option>
				           <%
				          	for(int i=1;i<indexs4.size();i++){
				          	%>	
				          	<option value="<%=indexs4.get(i).getIndexId() %>"> <%=" "+indexs4.get(i).getIndexName() %></option>
				          	<%
				          	}
				          %>
				           <option value="other" disabled="disabled">---其它---</option>
			        </select>
					</td>
	     		</tr>
	     		<tr>
	     			<td>
					  <b>请选择价格区间:</b>
					</td>
					<td>
			        <input type="text" name="itemMarketPriceLow" maxlength="7">元
					</td>
					<td>
			        <input type="text" name="itemMarketPriceUp"  maxlength="7">元
					</td>
	     		</tr>
					     		<tr>
	     			<td>
					  <b>请选择折扣区间:</b>
					</td>
			        <td>
			        <input type="text" name="itemdiscountLow">% 
					</td>
					<td>
			        <input type="text" name="itemdiscountUp">%
					</td>
	     		</tr>
				<tr>
				     <td>
					   <b>请输入商品名称:</b>
					 </td>
					 <td>
					   <input  id="itemNameId"   type="text" name="itemName" style="width:180px;height:18px"/>
					 	
					 </td>
					 
			    </tr>
	     	</table>
	     	</div>
	     	<input type="submit" value="查询">
	     </form> 
	     </div>
		<%
		}
		%>
	
	<jsp:include page="../B2C/footer.jsp" flush="true"></jsp:include>
  </body>
</html>